VERSION		:= V0.0.1
CC			:= gcc
TARGET		:= template
DEBUG		:= -Wall -c
DEFETSET	:= -DUSE_DEBUG

inc_path = -I ./
inc_path += -I ./func/
inc_path += -I ./func/queue/

src_path = ./
src_path += ./func/queue/

src = $(foreach dir, $(src_path),$(wildcard $(dir)*.c))

obj_name = $(patsubst %.c, %.o, $(src))

$(TARGET) : $(obj_name)
	$(CC) $(obj_name) -o $(TARGET)
	@echo "makefile compile version:$(VERSION),TARGET:$(TARGET)"

%.o : %.c
	$(CC) $(DEFETSET) $(DEBUG) $(inc_path) $^ -o $@


.PHONY:clean
clean:
	@echo "clean project"
	rm -rf *.o *.exe $(TARGET) $(obj_name)
	
run:
	./$(TARGET)

all:
	make
	make run

# SOURCE			:=$(wildcard ./*.c)					#查找该目录下的所有的c文件，并赋值变量到SOURCE
# OBJS			:=$(patsubst ./%.c,./%.o,$(SOURCE))	#将所有的c文件替换为o文件，然后赋值给OBJS
# $(TARGET):$(OBJS)